﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GtsServer.DAL;
using GtsServer.Model;
using System.Data;
using GtsServer.Common;

namespace GtsServer.Manage.Controller
{
    public class TaskUserController
    {
        TaskUserDAL dal = new TaskUserDAL();
        public List<TaskUserShow> GetList(string taskID, string sysAccount, int pageIndex, int pageSize, out int count, out int position)
        {
            List<TaskUserShow> list = new List<TaskUserShow>();
            position = 0;
            DataSet ds = dal.GetList(pageIndex, pageSize,taskID, sysAccount);
            count = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
            list = IListDataSet.DataSetToIList<TaskUserShow>(ds, 0).ToList();
            if (!string.IsNullOrEmpty(sysAccount) && !string.IsNullOrEmpty(taskID))
            {
                position = Convert.ToInt32(ds.Tables[2].Rows[0][0]);
            }
            return list;
        }
        //public List<TaskUserShow> GetListByIMSI(string strWhere = "")
        //{
        //    List<TaskUserShow> list = new List<TaskUserShow>();
        //    strWhere = "ur.IMSI='"+ strWhere+"'";
        //    DataSet ds = dal.GetList(pageIndex, pageSize,strWhere);
        //    list = IListDataSet.DataSetToIList<TaskUserShow>(ds, 0).ToList();
        //    return list;
        //}
        public int Add(TaskUser model)
        {
            return dal.Add(model);
        }

        public bool Update(TaskUser model)
        {
            return dal.Update(model);
        }
        public bool Delete(int ID)
        {
            return dal.Delete(ID);
        }
    }
}
